Sometimes, while working with Python lists, we can have a problem in which we require to extract every Kth element of list and slice out a new list from that. This type of problems are quite common as a variation of list slicing. Let’s discuss a way in which this can be done. Method : Using list slicing This task can be performed using list slicing functionality. The trick here is to use the skip functionality of list to get every Kth element of list. K, as defined can be used as skip element....
In this article, we will learn how to arrange the files in different directories according to their extensions. When you have a lot of files with different extension than you can simply use the script for your help....
In this article, we will see How To Get a Class Name of a class instance....
We have discussed Linked List Introduction and Linked List Insertion in previous posts on a singly linked list.Let us formulate the problem statement to understand the deletion process. Given a ‘key’, delete the first occurrence of this key in the linked list....
Given a string S consisting of lowercase English alphabets, the task is to print the longest word present in the given string in python....
Given day number, convert to date it refers to....
Given a list. The task is to convert it to a dictionary with the values as the list element and keys as the concatenation of the given string K and value....
Given a String and HTML tag, extract all the strings between the specified tag....
Given a list of dictionary, convert to dictionary with same key mapped with all values in as value list....
Sometimes, while working with Python lists, we can have a problem in which we need to remove all the negative elements from list. This kind of problem can have application in many domains such as school programming and web development. Let’s discuss certain ways in which this task can be performed....
Given two complex numbers z1 and z2. The task is to add and subtract the given complex numbers.Addition of complex number: In Python, complex numbers can be added using + operator.Examples:...
Sometimes, while working with data, we can have a problem in which we need to get the Nth word of a String. This kind of problem has many application in school and day-day programming. Let’s discuss certain ways in which this problem can be solved....